﻿<%@ WebHandler Language="C#" Class="Comment" %>

using System;
using System.Web;
using System.Data;
using System.Data.Common;
using System.Web.SessionState;


public class Comment : IHttpHandler, IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "application/json;charset=UTF-8";

            /* 安全性验证 */
            if (!Admins.IsLogin(true))
                Utils.ShowEnd(context, -2);

            int Item_Id = Convert.ToInt32(context.Request.Params["Item_Id"].ToString().Trim());
            string Item_Content = context.Request.Params["Item_Content"].ToString().Trim();
            int Item_Lang = Convert.ToInt32(context.Request.Params["Item_Lang"].ToString().Trim());
            int Id = Convert.ToInt32(context.Request.Params["Id"].ToString().Trim());
            /* 验证 */
            Item_Content = Utils.HtmlCodeClear(Item_Content);
            Item_Content = Utils.HtmlEncode(Item_Content);

            /* 数据库参数生成 */
            DbParameter[] param = {
                DBHelper.MakeInParam("@Item_Id",(DbType)SqlDbType.Int,4,Item_Id),
                DBHelper.MakeInParam("@Item_Content",(DbType)SqlDbType.NText,2400,Item_Content),
                DBHelper.MakeInParam("@Lang",(DbType)SqlDbType.TinyInt,1,Item_Lang),
                DBHelper.MakeInParam("@Id",(DbType)SqlDbType.TinyInt,1,Id),
            };

            int Status = Convert.ToInt32(DBHelper.ExecuteScalar(CommandType.StoredProcedure, "Comment_Reply_AddEdit", param));
            Utils.ShowEnd(context, Status);


    }
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}